﻿using System.Data;

namespace TfsReports.Web.Models
{
    /// <summary>
    /// BuildChangeset
    /// </summary>
    public class BuildChangeset
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildChangeset"/> class.
        /// </summary>
        /// <param name="buildId">The build id.</param>
        /// <param name="changesetId">The changeset id.</param>
        public BuildChangeset(int buildId, int changesetId)
        {
            BuildId = buildId;
            ChangesetId = changesetId;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BuildChangeset"/> class.
        /// </summary>
        /// <param name="dataRecord">The data record.</param>
        public BuildChangeset(IDataRecord dataRecord)
            : this(dataRecord.GetInt32(dataRecord.GetOrdinal("BuildId")), dataRecord.GetInt32(dataRecord.GetOrdinal("ChangesetId")))
        {}

        /// <summary>
        /// Gets or sets the build id.
        /// </summary>
        /// <value>The build id.</value>
        public int BuildId { get; private set; }

        /// <summary>
        /// Gets or sets the changeset id.
        /// </summary>
        /// <value>The changeset id.</value>
        public int ChangesetId { get; private set; }
    }
}
